# -*- coding: utf-8 -*-
from venv1.Page.customerInfoPage import customerInfoPage
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.touch_actions import TouchActions
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait
import time
import xlrd
class paperInfo():
    def __init__(self, driver):
        self.driver = driver
        self.customerinfo = customerInfoPage(self.driver)

    def paperinfo(self, list_data):
        print(list_data)
        time.sleep(5)
        # print(self.customerinfo.name().get_attribute('value') + '4534534')
        if self.customerinfo.name().get_attribute('value') == '':
            self.customerinfo.name().send_keys(list_data[0])
            self.customerinfo.sex().click()
            time.sleep(1)
            if list_data[3] == "男":
                self.customerinfo.sexM().click()
            else:
                self.customerinfo.sexF().click()
            self.customerinfo.maritalStatus().click()
            time.sleep(2)
            if list_data[8] == "未婚":
                self.customerinfo.maritalStatus01().click()
            else:
                self.customerinfo.maritalStatus02().click()
            self.customerinfo.contry().click()
            time.sleep(1)
            if list_data[9] == "中国":
                self.customerinfo.china().click()
            elif list_data[9] == "中国台湾":
                self.customerinfo.taiwai().click()
            elif list_data[9] == "中国香港":
                self.customerinfo.HongKong().click()
            elif list_data[9] == "中国澳门":
                self.customerinfo.Macao().click()
            self.customerinfo.Birth().send_keys(list_data[2])
            self.customerinfo.idType().click()
            time.sleep(1)
            if list_data[10] == "居民身份证":
                self.customerinfo.idType01().click()
            elif list_data[10] == "户口簿":
                self.customerinfo.idType02().click()
            elif list_data[10] == "中国人民解放军军官证":
                self.customerinfo.idType03().click()
            elif list_data[10] == "出生医学证明":
                self.customerinfo.idType04().click()
            elif list_data[10] == "普通护照":
                self.customerinfo.idType05().click()
            elif list_data[10] == "港澳同胞回乡证":
                self.customerinfo.idType06().click()
            elif list_data[10] == "台湾居民定居证":
                self.customerinfo.idType07().click()
            self.customerinfo.idNum().send_keys(list_data[1])
            if list_data[11] == '长期':
                self.customerinfo.idEnd().click()
            else:
                self.customerinfo.idDate().send_keys(list_data[11])
            time.sleep(1)
            self.customerinfo.Tel().send_keys(list_data[12])
            self.customerinfo.Mail().send_keys(list_data[13])
            self.customerinfo.address().click()
            time.sleep(2)
            self.customerinfo.provice(list_data[14]).click()
            self.driver.implicitly_wait(10)
            self.customerinfo.city(list_data[15]).click()
            self.driver.implicitly_wait(10)
            self.customerinfo.area(list_data[16]).click()
            self.customerinfo.addressDetail().send_keys(list_data[17])
            self.customerinfo.postCode().send_keys(list_data[18])

            self.customerinfo.workAddresss().click()
            time.sleep(1)
            self.customerinfo.workProvice(list_data[19]).click()
            time.sleep(5)
            self.customerinfo.workCity(list_data[20]).click()
            time.sleep(5)
            self.customerinfo.workArea(list_data[21]).click()
            time.sleep(1)
            self.customerinfo.workDetail().send_keys(list_data[22])
            self.customerinfo.workPost().send_keys(list_data[23])
            self.customerinfo.workerName().send_keys(list_data[24])
            time.sleep(3)
            self.customerinfo.workerResult(list_data[24]).click()
            self.customerinfo.income().send_keys(list_data[25])
            self.customerinfo.familyIncome().send_keys(list_data[26])
            self.customerinfo.education().click()
            time.sleep(1)
            self.customerinfo.educationConfirm(list_data[27]).click()
            self.customerinfo.company().send_keys(list_data[28])
            self.customerinfo.relation(list_data[29]).click()
            if list_data[29] == "本人":
                pass
            else:
                if list_data[29] == "其他":
                    self.customerinfo.otherRelation().send_keys()
                self.customerinfo.protectName().send_keys(list_data[31])
                self.customerinfo.protectSex().click()
                time.sleep(1)
                self.customerinfo.protectSexConfirm(list_data[32]).click()
                self.customerinfo.protectMarry().click()
                time.sleep(1)
                self.customerinfo.protectmarryConfirm(list_data[33]).click()
                self.customerinfo.protectContry().click()
                time.sleep(1)
                self.customerinfo.protectcontryConfirm(list_data[34]).click()
                self.customerinfo.protectBirth().send_keys(list_data[35])
                self.customerinfo.protectidType().click()
                time.sleep(1)
                self.customerinfo.protectidTypeCon(list_data[36]).click()
                self.customerinfo.protectidNum().send_keys(list_data[37])
                if list_data[38] == '长期':
                    self.customerinfo.protectidend().click()
                else:
                    self.customerinfo.protectiddate().send_keys(list_data[38])
                self.customerinfo.protectTel().send_keys(list_data[39])
                self.customerinfo.protectMail().send_keys(list_data[40])
                self.customerinfo.protectAddress().click()
                time.sleep(1)
                self.customerinfo.protectProvice(list_data[41]).click()
                time.sleep(5)
                self.customerinfo.protectCity(list_data[42]).click()
                time.sleep(5)
                self.customerinfo.protectArea(list_data[43]).click()
                self.customerinfo.protectAddressDetail().send_keys(list_data[44])
                print(list_data[45])
                self.customerinfo.protectPost().send_keys(list_data[45])
                self.customerinfo.proworkAdd().click()
                time.sleep(2)
                self.customerinfo.proworkProvice(list_data[46]).click()
                time.sleep(5)
                self.customerinfo.protectCity(list_data[47]).click()
                time.sleep(5)
                self.customerinfo.protectArea(list_data[48]).click()
                self.customerinfo.proworkAddDetail().send_keys(list_data[49])
                self.customerinfo.proworkPost().send_keys(list_data[50])
                self.customerinfo.proworkerName().send_keys(list_data[51])
                time.sleep(1)
                self.customerinfo.proworkerResult(list_data[51]).click()
                self.customerinfo.protectIncome().send_keys(list_data[52])
                self.customerinfo.proeducation().click()
                time.sleep(1)
                self.customerinfo.proeducationConfirm(list_data[53]).click()
                self.customerinfo.protectCompany().send_keys(list_data[54])
                #保单通讯地址
                self.customerinfo.policyAddress().click()
                time.sleep(1)
                self.customerinfo.policyAddressConfirm(list_data[55]).click()
            self.customerinfo.next().click()
        else:
            self.customerinfo.next().click()

